<?php

namespace App\Request\auth\Service\Config;

use App\Http\Api\CurrentUser;
use App\Repository\Config\ConfigDataRepository;
use App\Request\auth\Service\IService;
use App\Request\auth\Service\Jwt\JwtService;
use Hyperf\DbConnection\Model\Model;

/**
 * 配置数据管理 Service类
 */
class ConfigDataService extends IService
{
    public function __construct(
        protected readonly ConfigDataRepository $repository,
        protected readonly CurrentUser          $currentUser,
        protected readonly JwtService           $jwtService
    )
    {
    }


    /**
     * 获取配置详情 用来显示在左侧菜单
     * @param int $configId
     * @return Model|mixed|null
     */
    public function getConfigDetail(int $configId): mixed
    {
       return $this->repository->findByFilter(['config_id' => $configId])->append(["config_name"]);
    }

}